package cn.nexd.location.collector;


/**
 * Nexd 定位的配置类.
 * Created by codingfish on 15/9/28.
 */
public final class NexdCollectorConfig {

    public String appKey;
    public int wifiCollectorRate;
    public int bluetoothCollectorRate;
    public boolean wifiCollectorEnable;
    public boolean bluetoothCollectorEnable;

    public NexdCollectorConfig(Buidler buidler) {
        this.appKey = buidler.app_key;
        this.wifiCollectorRate = buidler.wifi_collector_rate;
        this.wifiCollectorEnable = buidler.wifi_collector_enable;
        this.bluetoothCollectorEnable = buidler.bluetooth_collector_enable;
        this.bluetoothCollectorRate = buidler.bluetooth_collector_rate;
    }


    public static class Buidler {
        private String app_key = "";//appKey

        private int wifi_collector_rate = 1000;//默认wifi采集器频率
        private int bluetooth_collector_rate = 1000;//默认蓝牙采集器频率

        private boolean wifi_collector_enable = true;//Wifi 是否采集
        private boolean bluetooth_collector_enable = false; // 蓝牙是否采集

        public NexdCollectorConfig build() {
            return new NexdCollectorConfig(this);
        }

        /**
         * 设置 AppKey
         *
         * @param app_key
         */
        public Buidler setAppkey(String app_key) {
            this.app_key = app_key;
            return this;
        }

        /**
         * 设置 wifi 采集的频率。
         *
         * @param wifi_collector_rate 频率（多少间隔采集一次），单位毫秒
         */
        public void setWifiCollectorRate(int wifi_collector_rate) {
            this.wifi_collector_rate = wifi_collector_rate;
        }

        /**
         * 设置 蓝牙 采集的频率。
         *
         * @param wifi_collector_rate 频率（多少间隔采集一次），单位毫秒
         */
        public void setBluetoothCollectorRate(int bluetooth_collector_rate) {
            this.bluetooth_collector_rate = bluetooth_collector_rate;
        }

        /**
         * 设置是否启动 Wifi 采集器。
         *
         * @param wifi_collector_enable
         */
        public void setWifiCollectorEnable(boolean wifi_collector_enable) {
            this.wifi_collector_enable = wifi_collector_enable;
        }

        /**
         * 设置是否启用蓝牙
         *
         * @param bluetooth_collector_enable
         */
        public void setBluetoothCollectorEnable(boolean bluetooth_collector_enable) {
            this.bluetooth_collector_enable = bluetooth_collector_enable;
        }
    }
}
